package game.module.turntables.logic;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import game.HallServer;
import game.module.hall.bean.SettingBean;
import game.module.turntables.bean.TurntableBean;
import game.module.turntables.dao.TurntableDBDao;

public class TurntableDBHelper {

	private static Logger logger = LoggerFactory.getLogger(TurntableDBHelper.class);
	
	static class SingletonHolder{
		static TurntableDBHelper instance = new TurntableDBHelper();
	}
	
	public static TurntableDBHelper getInstance()
	{
		return SingletonHolder.instance;
		
	}
	
	public void asyncAddTurntable(final TurntableBean turntableBean ) {
		HallServer.executorService.execute(new Runnable() {
			
			@Override
			public void run() {
				// TODO Auto-generated method stub
				TurntableDBDao.getInstance().addTurntable(turntableBean);
			}
		});
	}
	
	public void asyncUpdateTurntable(final TurntableBean settingBean) {
		HallServer.executorService.execute(new Runnable() {
			
			@Override
			public void run() {
				// TODO Auto-generated method stub
				TurntableDBDao.getInstance().updateTurntable(settingBean);
			}
		});
	}
	
	public void asyncgetTurntableById(int playerId) {
		HallServer.executorService.execute(new Runnable() {
			
			@Override
			public void run() {
				// TODO Auto-generated method stub
				TurntableDBDao.getInstance().getTurntableById(playerId);
			}
		});
	}
}
